# -*- coding: utf-8 -*-
"""
Module Description: 解析HTTP请求
"""
from framework.firefly_dc.global_errcode import GlobalErrCode
from framework.interceptor.base_interceptor import BaseInterceptor


class RequestFormatInterceptor(BaseInterceptor):
    """解析http请求"""

    @staticmethod
    def pre_process(request, response):
        # 检验是否有actionid
        if not request.action_id:
            response.set_stat(GlobalErrCode.FAILED)
            return False

        # 设置响应对象的action_id
        response.set_action_id(request.action_id)

        return True
